package com.example.demoplus.ui.main;

import android.content.Context;

import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.demoplus.R;
import com.example.demoplus.ui.dashboard.DashboardFragment;
import com.example.demoplus.ui.home.HomeFragment;
import com.example.demoplus.ui.notifications.NotificationsFragment;
import com.example.demoplus.ui.order.EvaluateFragment;
import com.example.demoplus.ui.order.OrderFragment;
import com.example.demoplus.ui.order.RefundFragment;

/**
 * A [FragmentPagerAdapter] that returns a fragment corresponding to
 * one of the sections/tabs/pages.
 */
public class SectionsPagerAdapter extends FragmentPagerAdapter {

    private static final String[] TAB_TITLES = new String[]{"全部订单","待评价"};
    private static final Fragment[] FRAGMENT = new Fragment[]{
            OrderFragment.newInstance(),
            EvaluateFragment.newInstance()};
    private final Context mContext;

    public SectionsPagerAdapter(Context context, FragmentManager fm) {
        super(fm);
        mContext = context;
    }

    @Override
    public Fragment getItem(int position) {
        // getItem is called to instantiate the fragment for the given page.
        // Return a PlaceholderFragment (defined as a static inner class below).
        return FRAGMENT[position];
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return TAB_TITLES[position];
    }

    @Override
    public int getCount() {
        // Show 2 total pages.
        return TAB_TITLES.length;
    }
}